{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "Text provided under a Creative Commons Attribution license, CC-BY.  All code is made available under the FSF-approved BSD-3 license.  (c) Lorena A. Barba, Gilbert F. Forsyth 2017. Thanks to NSF for support via CAREER award #1149784."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[@LorenaABarba](https://twitter.com/LorenaABarba)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "12 steps to Navier–Stokes\n",
    "======\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This Jupyter notebook continues the presentation of the **12 steps to Navier–Stokes**, the practical module taught in the interactive CFD class of [Prof. Lorena Barba](http://lorenabarba.com). You should have completed [Step 1](./01_Step_1.ipynb) before continuing, having written your own Python script or notebook and having experimented with varying the parameters of the discretization and observing what happens.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Step 2: Nonlinear Convection\n",
    "-----\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we're going to implement nonlinear convection using the same methods as in step 1.  The 1D convection equation is:\n",
    "\n",
    "$$\\frac{\\partial u}{\\partial t} + u \\frac{\\partial u}{\\partial x} = 0$$\n",
    "\n",
    "Instead of a constant factor $c$ multiplying the second term, now we have the solution $u$ multiplying it. Thus, the second term of the equation is now *nonlinear*. We're going to use the same discretization as in Step 1 — forward difference in time and backward difference in space. Here is the discretized equation.\n",
    "\n",
    "$$\\frac{u_i^{n+1}-u_i^n}{\\Delta t} + u_i^n \\frac{u_i^n-u_{i-1}^n}{\\Delta x} = 0$$\n",
    "\n",
    "Solving for the only unknown term, $u_i^{n+1}$, yields:\n",
    "\n",
    "$$u_i^{n+1} = u_i^n - u_i^n \\frac{\\Delta t}{\\Delta x} (u_i^n - u_{i-1}^n)$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As before, the Python code starts by loading the necessary libraries. Then, we declare some variables that determine the discretization in space and time (you should experiment by changing these parameters to see what happens). Then, we create the initial condition $u_0$ by initializing the array for the solution using $u = 2\\ @\\ 0.5 \\leq x \\leq 1$  and $u = 1$ everywhere else in $(0,2)$ (i.e., a hat function)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy                 # we're importing numpy \n",
    "from matplotlib import pyplot    # and our 2D plotting library\n",
    "%matplotlib inline\n",
    "\n",
    "\n",
    "nx = 41\n",
    "dx = 2 / (nx - 1)\n",
    "nt = 20    #nt is the number of timesteps we want to calculate\n",
    "dt = .025  #dt is the amount of time each timestep covers (delta t)\n",
    "\n",
    "u = numpy.ones(nx)      #as before, we initialize u with every value equal to 1.\n",
    "u[int(.5 / dx) : int(1 / dx + 1)] = 2  #then set u = 2 between 0.5 and 1 as per our I.C.s\n",
    "\n",
    "un = numpy.ones(nx) #initialize our placeholder array un, to hold the time-stepped solution"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The code snippet below is *unfinished*. We have copied over the line from [Step 1](./01_Step_1.ipynb) that executes the time-stepping update. Can you edit this code to execute the nonlinear convection instead?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA1e0lEQVR4nO3de5QU9Z3//1d1V/WACYwShWFkghijeEVchUU3K0QUkUPk7Pl6TYR4SdSFREJiVn77XZFv9iya1bibDWpMVMxGIWgUjboqUQeOBKMgc1Y0GBUSMDKYkDgzoE5XdX9+f3RVDROuDdNTt+fjnDn2NNXTn/JT1fXq9+dTVZYxxggAACAiuagbA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AAIgUYQQAAEQq02Gkrq5Oc+bMUV1dXdRNqZm0ryPrl3xpX8e0r5+U/nVk/WovERNYAQBAemW6MgIAAKJHGAEAAJEijAAAgEgRRgAAQKRSF0bmz5+vI444Qn369NHo0aP18ssv73H5hx56SMOHD1efPn104okn6qmnnur278YY3XjjjRo8eLD69u2r8ePH66233qrlKuxRNev3ox/9SJ/73Od0yCGH6JBDDtH48eN3Wv7LX/6yLMvq9nPuuefWejX2qJp1XLBgwU7t79OnT7dlktyHY8eO3Wn9LMvSpEmTwmXi1IfLly/X5MmT1djYKMuytGTJkr2+prm5Waeccorq6up01FFHacGCBTstU+1+XSvVrt8jjzyis88+W4cddpj69++vMWPG6Jlnnum2zE033bRT/w0fPryGa7Fn1a5jc3PzLrfR1tbWbssltQ93tX9ZlqXjjz8+XCZOfThv3jyddtpp6tevnwYOHKgpU6bozTff3Ovroj4WpiqM/OxnP9OsWbM0Z84cvfrqqxoxYoQmTJig999/f5fL/+pXv9Ill1yiK6+8UmvWrNGUKVM0ZcoUrV27Nlzmu9/9rr7//e/rrrvu0q9//Wt94hOf0IQJE/Txxx/31mqFql2/5uZmXXLJJXrhhRe0cuVKNTU16ZxzztEf/vCHbsude+652rx5c/izcOHC3lidXap2HaXKVQN3bP/vf//7bv+e5D585JFHuq3b2rVrlc/ndcEFF3RbLi59uH37do0YMULz58/fp+U3bNigSZMmady4cWppadHMmTN11VVXdTtg7882USvVrt/y5ct19tln66mnntLq1as1btw4TZ48WWvWrOm23PHHH9+t/1588cVaNH+fVLuOgTfffLPbOgwcODD8tyT34X/+5392W69NmzZpwIABO+2DcenDZcuWafr06XrppZe0dOlSua6rc845R9u3b9/ta2JxLDQpMmrUKDN9+vTw91KpZBobG828efN2ufyFF15oJk2a1O250aNHm6uvvtoYY0y5XDYNDQ3m3//938N//+CDD0xdXZ1ZuHBhDdZgz6pdv7/meZ7p16+fuf/++8Pnpk2bZs4///yebup+q3Yd77vvPlNfX7/bv5e2Prz99ttNv379zLZt28Ln4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fRS+G9nnnmmmTZtWrflFy9ebI4++mhTKBTM8ccfb5588slu/14ul82//Mu/mEGDBpm6ujpz1llnmTfffLM3VmWXqlm/oUOHGkk7/cyZM8cYY8yHH35ozjnnHHPYYYcZx3HM0KFDzVe+8pVIPiB2VM06zpw5M1x20KBB5rzzzjOvvvpqt7+X5D40xph169YZSebZZ5/d6W/FrQ+D0zz/+idYp2nTppkzzzxzp9ecfPLJplAomCOPPNLcd999O/3dPf0/603Vrt+ZZ565x+WNqZzKPHjwYFMoFMzhhx9uLrroIvP222/37ortoNp1vOWWW8xnPvMZ06dPHzNgwAAzduxY8/zzz+/0d5Pah8ZUTmPt27evufvuu3f5N+PUh7taN0nd9qs4Hgstv/EAAACRSM2cEQAAkEyEEQAAECnCCAAAiBRhBAAARIowAgAAIkUYAQAAkSKMAACASBFGAABApAgjAAAgUoQRAAAQKcIIAACIFGEEAABE6v8HiPpbn7S8DQ4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for n in range(nt):  #iterate through time\n",
    "    un = u.copy() ##copy the existing values of u into un\n",
    "    for i in range(1, nx):  ##now we'll iterate through the u array\n",
    "    \n",
    "     ###This is the line from Step 1, copied exactly.  Edit it for our new equation.\n",
    "     ###then uncomment it and run the cell to evaluate Step 2   \n",
    "      \n",
    "           ###u[i] = un[i] - c * dt / dx * (un[i] - un[i-1]) \n",
    "        pyplot.plot(numpy.linspace(0, 2, nx), u) ##Plot the results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "What do you observe about the evolution of the hat function under the nonlinear convection equation? What happens when you change the numerical parameters and run again?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Learn More"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For a careful walk-through of the discretization of the convection equation with finite differences (and all steps from 1 to 4), watch **Video Lesson 4** by Prof. Barba on YouTube."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkz\nODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2MBERISGBUYLxoaL2NCOEJjY2NjY2NjY2Nj\nY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY//AABEIAWgB4AMBIgACEQED\nEQH/xAAaAAEAAwEBAQAAAAAAAAAAAAAAAQIDBAUG/8QAOBAAAgIBAwEFBgUDBAIDAAAAAAECAxEE\nEiExBRNBUXEUIjJhcoEjNJGhsRXB0UJS8PEz4SRik//EABYBAQEBAAAAAAAAAAAAAAAAAAABAv/E\nABcRAQEBAQAAAAAAAAAAAAAAAAABESH/2gAMAwEAAhEDEQA/APvwAAAK7knhtfqBYEEgAQM84AkE\nbl5r9SQAIbS8SHKKaTay+i8wLArGSlna08cPBIEggkAAAAAAAAAAABBJD4WQBJww16d1UZ7UrFJ8\nPmLXOP5OyM4SxtknlZWH1QFgAAIJMtRb3NTnjPK8fmBoDzb+0YR77daod20k0/jyuPTxOzT25pqV\nlkZWSgm2vHjloDcERalFSTynymiQAAAAEAAc1/4mrpqeduHN4fljH8l9PqIajvNieITcG34tDBuQ\nMpdWY13Z1Ftcmko7WufB/wDQG4II3LLWVleAFgZV31WqTrnGSi8PD6FXqqtrkpZSSlleOegGwOO2\n5WQpvjujstSlGXDWeOf1NoylTXZPUTWNzaflHwCNpPCb6/IrVZG2uM4PMZLKEZwnFSjJNNZTMKPw\ntVbSvhaVkflnOV+q/cDqAAUAAAAAAAAAAFLJONcpJZaTaR4uvTrhTOF7bltdiTWGm+rzzjw4PdOO\nfZtE5qTgnj4cpNx9PIC+leO9rzmNcsR+Sx0KPtLTJ4bn/wDnI6Kq41QUI9F4vq/my4GN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si6Dkpahz\ni5qWXnlKW7n+C39Ks30ylbGXdyjLLT4xnhfqYY7WjGxN3zVjfPu5gtzxt+2Op6PZMbodm0x1MZRt\nSe5TeX1fUDtIJAEAkAQCQBAJAEAkAQCQBAJAEAkAAAAAAAAAAAAAAAgkgASQSABAAkEEgAQAJAAA\ngkgASAAAAAAAACAJAAAAAAABjqvytv0s0j8C9CmpTemtSWW4svH4V6AWAAAAAAAAAAEAACQAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAQCQBBIAEAkAAQAJAAAAAACAJBBIEAkAAAAAAAAAQCQAAAAAAAA\nAAAEAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCQAAAAAACCSABJBIAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCSABJBIAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAIJIAZWcZ56kOSXVpFLKd7b3bcxcSi0qWfeys55XTnIG+SHOMcZf\nUw9lb62yfGEadzxFbvdTzjzA0M/aK+/7nd7/AKft6mmDlnoYS7QhrN0lKCxtT4b6Zf2YHUAAJAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAJIJAAgk\nAAAB/9k=\n",
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"400\"\n",
       "            height=\"300\"\n",
       "            src=\"https://www.youtube.com/embed/y2WaK7_iMRI\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.YouTubeVideo at 0x7f994c6c0ac8>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import YouTubeVideo\n",
    "YouTubeVideo('y2WaK7_iMRI')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<link href='http://fonts.googleapis.com/css?family=Fenix' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans:100,300,400,500,700,800,900,100italic,300italic,400italic,500italic,700italic,800italic,900italic' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:300,400' rel='stylesheet' type='text/css'>\n",
       "<style>\n",
       "    @font-face {\n",
       "        font-family: \"Computer Modern\";\n",
       "        src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n",
       "    }\n",
       "    div.cell{\n",
       "        width:800px;\n",
       "        margin-left:16% !important;\n",
       "        margin-right:auto;\n",
       "    }\n",
       "    h1 {\n",
       "        font-family: 'Alegreya Sans', sans-serif;\n",
       "    }\n",
       "    h2 {\n",
       "        font-family: 'Fenix', serif;\n",
       "    }\n",
       "    h3{\n",
       "\t\tfont-family: 'Fenix', serif;\n",
       "        margin-top:12px;\n",
       "        margin-bottom: 3px;\n",
       "       }\n",
       "\th4{\n",
       "\t\tfont-family: 'Fenix', serif;\n",
       "       }\n",
       "    h5 {\n",
       "        font-family: 'Alegreya Sans', sans-serif;\n",
       "    }\t   \n",
       "    div.text_cell_render{\n",
       "        font-family: 'Alegreya Sans',Computer Modern, \"Helvetica Neue\", Arial, Helvetica, Geneva, sans-serif;\n",
       "        line-height: 135%;\n",
       "        font-size: 120%;\n",
       "        width:600px;\n",
       "        margin-left:auto;\n",
       "        margin-right:auto;\n",
       "    }\n",
       "    .CodeMirror{\n",
       "            font-family: \"Source Code Pro\";\n",
       "\t\t\tfont-size: 90%;\n",
       "    }\n",
       "/*    .prompt{\n",
       "        display: None;\n",
       "    }*/\n",
       "    .text_cell_render h1 {\n",
       "        font-weight: 200;\n",
       "        font-size: 50pt;\n",
       "\t\tline-height: 100%;\n",
       "        color:#CD2305;\n",
       "        margin-bottom: 0.5em;\n",
       "        margin-top: 0.5em;\n",
       "        display: block;\n",
       "    }\t\n",
       "    .text_cell_render h5 {\n",
       "        font-weight: 300;\n",
       "        font-size: 16pt;\n",
       "        color: #CD2305;\n",
       "        font-style: italic;\n",
       "        margin-bottom: .5em;\n",
       "        margin-top: 0.5em;\n",
       "        display: block;\n",
       "    }\n",
       "    \n",
       "    .warning{\n",
       "        color: rgb( 240, 20, 20 )\n",
       "        }  \n",
       "</style>\n",
       "<script>\n",
       "    MathJax.Hub.Config({\n",
       "                        TeX: {\n",
       "                           extensions: [\"AMSmath.js\"]\n",
       "                           },\n",
       "                tex2jax: {\n",
       "                    inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
       "                    displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
       "                },\n",
       "                displayAlign: 'center', // Change this to 'center' to center equations.\n",
       "                \"HTML-CSS\": {\n",
       "                    styles: {'.MathJax_Display': {\"margin\": 4}}\n",
       "                }\n",
       "        });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.core.display import HTML\n",
    "def css_styling():\n",
    "    styles = open(\"../styles/custom.css\", \"r\").read()\n",
    "    return HTML(styles)\n",
    "css_styling()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> (The cell above executes the style for this notebook.)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
